package com.example.znyt.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.znyt.model.dto.picture.PictureQueryRequest;
import com.example.znyt.model.dto.picture.PictureReviewRequest;
import com.example.znyt.model.dto.picture.PictureUploadByBatchRequest;
import com.example.znyt.model.dto.picture.PictureUploadRequest;
import com.example.znyt.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.znyt.model.entity.User;
import com.example.znyt.model.vo.PictureVO;
import com.example.znyt.response.BaseResponse;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
* @author 12336
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-06-17 14:47:39
*/
public interface PictureService extends IService<Picture> {

    /**
     * 上传图片
     * @param inputSource
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    public PictureVO uploadPicture(Object inputSource,
                                   PictureUploadRequest pictureUploadRequest,
                                   User loginUser);

    /**
     * 转化querwrapper对象
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> queryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 分页列表图片信息
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);


    /**
     * 关联图片用户信息
      * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 校验图片信息
     * @param picture
     */
    void validPicture(Picture picture);


    /**
     * 图片审核
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);


    /**
     * 补充审核参数
     * @param picture
     * @param loginUser
     */
    void fillReviewParams(Picture picture, User loginUser);

    /**
     * 批量上传图片
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return
     */
    Integer uploadPictureByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest, User loginUser);

    void deletePicture(long pictureId, User loginUser);


    /**
     * 异步清理操作
     * @param oldPicture
     */
    void clearPictureFile(Picture oldPicture);

    void checkPictureAuth(User loginUser, Picture picture);
}
